package com.forum.server.impl;

import com.forum.dto.UserDTO;
import com.forum.entity.User;
import com.forum.mapper.UserMapper;
import com.forum.server.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @date: 2023/11/7 13:06
 * @author: hongdou
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public User login(UserDTO userDTO) {
        String name = userDTO.getName();
        User user = userMapper.getByUserName(name);
        if (user.equals(null)){
            throw new RuntimeException();
        }

        return user;
    }
}
